﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ExportSettings.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the ExportSettings type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.SharePoint.Wss.ContentMigration
{
    using System;
    using System.Xml.Serialization;

    using Attributes;

    [CollaborisClass(
        Title = "Export Settings.",
        ReleaseStatus = ReleaseStatus.Stable,
        DisableDocumentation = false,
        ContactAuthorEmail = "Support@Collaboris.co.uk",
        Summary = "Defines the settings to export to a Content Migration Package (CMP).",
        ClassGuid = "{116E17A5-A7BA-4e1f-8A48-1BC341A7C662}"
    )]
    [Serializable]
    public class ExportSettings
    {
        #region Constants and Fields

        private string baseFileName;

        private bool fileCompression;

        private string fileLocation;

        private int fileMaxSize;

        private bool includeDependencies;

        private bool includeSecurity;

        private bool includeVersions;

        private string logFilePath;

        private bool overwriteExistingDataFile;

        #endregion

        #region Properties

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies the file name of the CMP file. (Usually *.cab).",
             Title = "Base File Name.",
             Example = "exported_content.cmp",
             InputHint = InputHint.SingleText)]
        public string BaseFileName
        {
            get
            {
                return this.baseFileName;
            }

            set
            {
                this.baseFileName = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies whether to use compression on the CMP file.",
             Title = "File Compression.",
             Example = "true",
             InputHint = InputHint.Boolean)]
        public bool FileCompression
        {
            get
            {
                return this.fileCompression;
            }

            set
            {
                this.fileCompression = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies the file location to containing the CMP.",
             Title = "File Location.",
             Example = @"${CurrentDirectory}",
             InputHint = InputHint.SingleText)]
        public string FileLocation
        {
            get
            {
                return this.fileLocation;
            }

            set
            {
                this.fileLocation = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies the maximum file size for the CMP to grow to.",
             Title = "File Max Size.",
             Example = "0",
             Remarks = "If '0' (zero) is specified then this means the file size is not limited",
             InputHint = InputHint.Number)]
        public int FileMaxSize
        {
            get
            {
                return this.fileMaxSize;
            }

            set
            {
                this.fileMaxSize = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether to include 
        /// dependencies from the export package when 
        /// exporting objects of type SPFile or SPListItem. 
        /// </summary>
        /// <value><c>true</c> to include dependencies; otherwise, 
        /// <c>false</c> to exclude them.</value>
        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies whether to include dependent object in the exported package.",
             Title = "Include Dependencies.",
             Example = "false",
             Remarks = "If 'true' is specified all dependent objects are exported.",
             InputHint = InputHint.Boolean)]
        public bool IncludeDependencies
        {
            get
            {
                return this.includeDependencies;
            }
            set
            {
                this.includeDependencies = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies whether to include users and permissions in the exported object.",
             Title = "Include Security.",
             Example = @"true",
             InputHint = InputHint.Boolean)]
        public bool IncludeSecurity
        {
            get
            {
                return this.includeSecurity;
            }

            set
            {
                this.includeSecurity = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies whether to include older version information in the exported object.",
             Title = "Include Versions.",
             Example = @"true",
             InputHint = InputHint.Boolean)]
        public bool IncludeVersions
        {
            get
            {
                return this.includeVersions;
            }

            set
            {
                this.includeVersions = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies the location to store the generated log to.",
             Title = "Log File Path.",
             Example = @"${TEMP}\Migration\ExportLog.txt",
             InputHint = InputHint.SingleText)]
        public string LogFilePath
        {
            get
            {
                return this.logFilePath;
            }

            set
            {
                this.logFilePath = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
             Summary = "Specifies whether to overwrite the existing CMP file.",
             Title = "Overwrite Existing Data File.",
             Example = @"true",
             InputHint = InputHint.Boolean)]
        public bool OverwriteExistingDataFile
        {
            get
            {
                return this.overwriteExistingDataFile;
            }

            set
            {
                this.overwriteExistingDataFile = value;
            }
        }

        #endregion
    }
}